package vistas.ui;
import java.awt.Component;

import java.awt.event.ActionEvent;
import java.util.Vector;

import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;
import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import controladores.ControladorAgregarClienteFrame;
import controladores.ControladorBorrarCategoriaFrame;
import controladores.ControladorModificarClienteFrame;
import controladores.interfaces.ControladorAdministradorCategorias;
import controladores.interfaces.ControladorAdministradorClientes;
import entidades.Categoria;
import entidades.Cliente;

/**
 * This code was edited or generated using CloudGarden's Jigloo
 * SWT/Swing GUI Builder, which is free for non-commercial
 * use. If Jigloo is being used commercially (ie, by a corporation,
 * company or business for any purpose whatever) then you
 * should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details.
 * Use of Jigloo implies acceptance of these licensing terms.
 * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
 * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
 * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
public class GenerarPresupuestoFrame extends javax.swing.JInternalFrame {
	private JLabel lblBuscarCliente;
	private JTextField txtTelefono;
	private JLabel lblDireccion;
	private JLabel lblTelefono;
	private JLabel lblFax;
	private JLabel lblEmail;
	private JPanel PanelModificadoresItems;
	private JButton btnBorrarItem;
	private JButton btnModificarItem;
	private JLabel lblTotal;
	private AbstractAction abstractAction7;
	private AbstractAction abstractAction6;
	private AbstractAction abstractAction5;
	private AbstractAction abstractAction4;
	private AbstractAction abstractAction3;
	private AbstractAction abstractAction2;
	private JCheckBox ChkBoxNuevoCliente;
	private JComboBox cmbCategoria;
	private AbstractAction abstractAction1;
	private JButton btnCancelar;
	private JButton btnAceptar;
	private JTextField txtTotal;
	private JComboBox cmbCondicionPago;
	private JTextField txtValidez;
	private JLabel lblValidez;
	private JLabel lblCondicionPago;
	private JButton btnAgregarItem;
	private JLabel lblCategoria;
	private JTextField txtNumeroPresupuesto;
	private JLabel lblNumeroPresupuesto;
	private JScrollPane jScrollPane1;
	private JList ListListadoItems;
	private JPanel PanelListadoItems;
	private JTextField txtEmail;
	private JTextField txtFax;
	private JTextField txtDireccion;
	private JLabel lblRazonSocial;
	private JTextField txtRazonSocial;
	private JLabel lblNombre;
	private JTextField txtNombre;
	private JTextField txtCuit;
	private JLabel lblCuit;
	private JPanel PanelDatosCliente;
	private JButton btnBuscarCliente;
	private JTextField txtCuitBuscado;

	/**
	 * Auto-generated main method to display this 
	 * JInternalFrame inside a new JFrame.
	 */
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		GenerarPresupuestoFrame inst = new GenerarPresupuestoFrame();
		JDesktopPane jdp = new JDesktopPane();
		jdp.add(inst);
		jdp.setPreferredSize(inst.getPreferredSize());
		frame.setContentPane(jdp);
		frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}

	public GenerarPresupuestoFrame() {
		super();
		initGUI();
	}

	private void initGUI() {
		try {
			this.setPreferredSize(new java.awt.Dimension(620, 468));
			this.setBounds(0, 0, 620, 468);
			GroupLayout thisLayout = new GroupLayout((JComponent)getContentPane());
			getContentPane().setLayout(thisLayout);
			setVisible(true);
			this.setTitle("Generar presupuesto");
			{
				lblBuscarCliente = new JLabel();
				lblBuscarCliente.setText("Buscar cliente:");
			}
			{
				txtCuitBuscado = new JTextField();
			}
			{
				btnBuscarCliente = new JButton();
				btnBuscarCliente.setText("Buscar");
				btnBuscarCliente.setAction(getAbstractAction1());
			}
			{
				PanelDatosCliente = new JPanel();
				GroupLayout PanelDatosClienteLayout = new GroupLayout((JComponent)PanelDatosCliente);
				PanelDatosCliente.setLayout(PanelDatosClienteLayout);
				PanelDatosCliente.setBorder(BorderFactory.createTitledBorder("Datos del cliente"));
				{
					lblCuit = new JLabel();
					lblCuit.setText("CUIT:");
				}
				{
					txtRazonSocial = new JTextField();
					txtRazonSocial.setEditable(false);
				}
				{
					lblRazonSocial = new JLabel();
					lblRazonSocial.setText("R. Social:");
				}
				{
					txtDireccion = new JTextField();
					txtDireccion.setEditable(false);
				}
				{
					lblDireccion = new JLabel();
					lblDireccion.setText("Direccion:");
				}
				{
					txtNombre = new JTextField();
					txtNombre.setEditable(false);
				}
				{
					lblNombre = new JLabel();
					lblNombre.setText("Nombre:");
				}
				{
					//					ComboBoxModel cmbCuitModel = 
					//							new DefaultComboBoxModel(
					//									new String[] { "Item One", "Item Two" });
					cmbCategoria = new JComboBox();
					//					cmbCategoria.setModel(cmbCuitModel);
					cmbCategoria.setEditable(false);
					ControladorAdministradorCategorias contCategorias = new ControladorBorrarCategoriaFrame();
					Vector<Categoria> categorias = new Vector<Categoria>();
					categorias = contCategorias.obtenerCategorias();
					for(Categoria cat : categorias){
						cmbCategoria.addItem(cat.getNombre());			
					}
				}
				{
					txtTelefono = new JTextField();
					txtTelefono.setEditable(false);
				}
				{
					lblTelefono = new JLabel();
					lblTelefono.setText("Telefono:");
				}
				{
					txtFax = new JTextField();
					txtFax.setEditable(false);
				}
				{
					lblFax = new JLabel();
					lblFax.setText("Fax:");
				}
				{
					txtEmail = new JTextField();
					txtEmail.setEditable(false);
				}
				{
					lblEmail = new JLabel();
					lblEmail.setText("E-mail:");
				}
				{
					lblCategoria = new JLabel();
					lblCategoria.setText("Categoria:");
				}
				{
					txtCuit = new JTextField();
					txtCuit.setEditable(false);
				}
				PanelDatosClienteLayout.setHorizontalGroup(PanelDatosClienteLayout.createSequentialGroup()
					.addContainerGap()
					.addGroup(PanelDatosClienteLayout.createParallelGroup()
					    .addComponent(lblRazonSocial, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblCuit, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblNombre, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE))
					.addGroup(PanelDatosClienteLayout.createParallelGroup()
					    .addComponent(txtRazonSocial, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE)
					    .addComponent(txtCuit, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE)
					    .addComponent(txtNombre, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					.addGroup(PanelDatosClienteLayout.createParallelGroup()
					    .addComponent(lblTelefono, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblFax, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblEmail, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					.addGroup(PanelDatosClienteLayout.createParallelGroup()
					    .addGroup(PanelDatosClienteLayout.createSequentialGroup()
					        .addGroup(PanelDatosClienteLayout.createParallelGroup()
					            .addComponent(txtTelefono, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE)
					            .addComponent(txtFax, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE))
					        .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
					        .addGroup(PanelDatosClienteLayout.createParallelGroup()
					            .addGroup(GroupLayout.Alignment.LEADING, PanelDatosClienteLayout.createSequentialGroup()
					                .addComponent(lblDireccion, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)
					                .addGap(12))
					            .addComponent(lblCategoria, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE)))
					    .addComponent(txtEmail, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 200, GroupLayout.PREFERRED_SIZE))
					.addGroup(PanelDatosClienteLayout.createParallelGroup()
					    .addComponent(cmbCategoria, GroupLayout.Alignment.LEADING, 0, 107, Short.MAX_VALUE)
					    .addGroup(PanelDatosClienteLayout.createSequentialGroup()
					        .addComponent(txtDireccion, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE)
					        .addGap(0, 0, Short.MAX_VALUE)))
					.addGap(8));
				PanelDatosClienteLayout.setVerticalGroup(PanelDatosClienteLayout.createSequentialGroup()
					.addGroup(PanelDatosClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(txtCuit, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
					    .addComponent(txtDireccion, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblDireccion, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
					    .addComponent(txtTelefono, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblTelefono, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblCuit, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					.addGroup(PanelDatosClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(cmbCategoria, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblCategoria, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
					    .addComponent(txtFax, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblFax, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
					    .addComponent(txtNombre, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblNombre, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					.addGroup(PanelDatosClienteLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(lblEmail, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
					    .addComponent(txtEmail, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)
					    .addComponent(txtRazonSocial, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(lblRazonSocial, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE))
					.addGap(6));
				PanelDatosClienteLayout.linkSize(SwingConstants.VERTICAL, new Component[] {txtCuit, lblCuit});
			}
			{
				PanelModificadoresItems = new JPanel();
				PanelModificadoresItems.setBorder(BorderFactory.createTitledBorder("Modificar Items del presupuesto"));
				{
					btnAgregarItem = new JButton();
					PanelModificadoresItems.add(btnAgregarItem);
					btnAgregarItem.setText("Agregar item");
					btnAgregarItem.setPreferredSize(new java.awt.Dimension(157, 22));
					btnAgregarItem.setAction(getAbstractAction4());
				}
				{
					btnModificarItem = new JButton();
					PanelModificadoresItems.add(btnModificarItem);
					btnModificarItem.setText("Modificar item");
					btnModificarItem.setPreferredSize(new java.awt.Dimension(157, 22));
					btnModificarItem.setAction(getAbstractAction2());
				}
				{
					btnBorrarItem = new JButton();
					PanelModificadoresItems.add(btnBorrarItem);
					btnBorrarItem.setText("Borrar item");
					btnBorrarItem.setPreferredSize(new java.awt.Dimension(157, 22));
					btnBorrarItem.setAction(getAbstractAction3());
				}
			}
			{
				btnAceptar = new JButton();
				btnAceptar.setText("Aceptar");
				btnAceptar.setAction(getAbstractAction7());
			}
			{
				btnCancelar = new JButton();
				btnCancelar.setText("Cancelar");
				btnCancelar.setAction(getAbstractAction6());
			}
			{
				lblValidez = new JLabel();
				lblValidez.setText("Validez (dias): ");
			}
			{
				txtValidez = new JTextField();
				txtValidez.setText("30");
			}
			{
				ComboBoxModel cmbCondicionPagoModel = 
						new DefaultComboBoxModel(
								new String[] { "Contado", "Cheque 30 dias", "Paga Dios" });
				cmbCondicionPago = new JComboBox();
				cmbCondicionPago.setModel(cmbCondicionPagoModel);
			}
			{
				lblTotal = new JLabel();
				lblTotal.setText("Total:");
			}
			{
				txtTotal = new JTextField();
			}
			{
				lblCondicionPago = new JLabel();
				lblCondicionPago.setText("Condicion de pago:");
			}
			thisLayout.setVerticalGroup(thisLayout.createSequentialGroup()
				.addContainerGap()
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(lblBuscarCliente, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
				    .addComponent(btnBuscarCliente, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(txtCuitBuscado, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(getChkBoxNuevoCliente(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				.addComponent(PanelDatosCliente, GroupLayout.PREFERRED_SIZE, 109, GroupLayout.PREFERRED_SIZE)
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				.addComponent(PanelModificadoresItems, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				.addComponent(getPanelListadoItems(), GroupLayout.PREFERRED_SIZE, 145, GroupLayout.PREFERRED_SIZE)
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(lblCondicionPago, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
				    .addComponent(cmbCondicionPago, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(lblValidez, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
				    .addComponent(txtValidez, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(lblTotal, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
				    .addComponent(txtTotal, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
				.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
				    .addComponent(btnCancelar, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(btnAceptar, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(getLblNumeroPresupuesto(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				    .addComponent(getTxtNumeroPresupuesto(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE))
				.addContainerGap());
			thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup()
				.addContainerGap()
				.addGroup(thisLayout.createParallelGroup()
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addGroup(thisLayout.createParallelGroup()
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(getLblNumeroPresupuesto(), GroupLayout.PREFERRED_SIZE, 162, GroupLayout.PREFERRED_SIZE)
				                .addComponent(getTxtNumeroPresupuesto(), GroupLayout.PREFERRED_SIZE, 154, GroupLayout.PREFERRED_SIZE))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(lblCondicionPago, GroupLayout.PREFERRED_SIZE, 127, GroupLayout.PREFERRED_SIZE)
				                .addComponent(cmbCondicionPago, GroupLayout.PREFERRED_SIZE, 189, GroupLayout.PREFERRED_SIZE)))
				        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, Short.MAX_VALUE)
				        .addComponent(lblValidez, GroupLayout.PREFERRED_SIZE, 92, GroupLayout.PREFERRED_SIZE)
				        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				        .addGroup(thisLayout.createParallelGroup()
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(txtValidez, GroupLayout.PREFERRED_SIZE, 35, GroupLayout.PREFERRED_SIZE)
				                .addGap(104))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addGap(18)
				                .addComponent(getChkBoxNuevoCliente(), GroupLayout.PREFERRED_SIZE, 121, GroupLayout.PREFERRED_SIZE)))
				        .addGap(29))
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addComponent(lblBuscarCliente, GroupLayout.PREFERRED_SIZE, 109, GroupLayout.PREFERRED_SIZE)
				        .addComponent(txtCuitBuscado, GroupLayout.PREFERRED_SIZE, 222, GroupLayout.PREFERRED_SIZE)
				        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				        .addGroup(thisLayout.createParallelGroup()
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(btnBuscarCliente, GroupLayout.PREFERRED_SIZE, 76, GroupLayout.PREFERRED_SIZE)
				                .addGap(55))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addPreferredGap(btnBuscarCliente, btnCancelar, LayoutStyle.ComponentPlacement.INDENT)
				                .addComponent(btnCancelar, GroupLayout.PREFERRED_SIZE, 119, GroupLayout.PREFERRED_SIZE)))
				        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				        .addGroup(thisLayout.createParallelGroup()
				            .addGroup(thisLayout.createSequentialGroup()
				                .addComponent(btnAceptar, GroupLayout.PREFERRED_SIZE, 119, GroupLayout.PREFERRED_SIZE))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(lblTotal, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)
				                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				                .addComponent(txtTotal, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)))
				        .addGap(0, 7, Short.MAX_VALUE))
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addComponent(PanelDatosCliente, GroupLayout.PREFERRED_SIZE, 594, GroupLayout.PREFERRED_SIZE)
				        .addGap(0, 6, Short.MAX_VALUE))
				    .addComponent(PanelModificadoresItems, GroupLayout.Alignment.LEADING, 0, 600, Short.MAX_VALUE)
				    .addComponent(getPanelListadoItems(), GroupLayout.Alignment.LEADING, 0, 600, Short.MAX_VALUE))
				.addGap(6));
			thisLayout.linkSize(SwingConstants.VERTICAL, new Component[] {lblTotal, txtTotal});
			thisLayout.linkSize(SwingConstants.VERTICAL, new Component[] {lblCondicionPago, lblValidez, txtValidez});
			thisLayout.linkSize(SwingConstants.VERTICAL, new Component[] {lblBuscarCliente, btnBuscarCliente});
			thisLayout.linkSize(SwingConstants.HORIZONTAL, new Component[] {btnAceptar, btnCancelar});
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	/*
	 * ------------------------------------------------------------------------------------------------
	 * 		Aca voy a tirar el controlador 'Maestro' de esta ventanan al cual reportan los otros
	 * 	controladores de los JinternalFrame
	 * ------------------------------------------------------------------------------------------------
	 */
	
	
	
	
	
	
	

	
	
	/*
	 * ------------------------------------------------------------------------------------------------
	 * 		Aca arranca el manejo de los action listeners de los elementos de esta ventana
	 * ------------------------------------------------------------------------------------------------
	 */
	
	private AbstractAction getAbstractAction1() {
		if(abstractAction1 == null) {
			abstractAction1 = new AbstractAction("Buscar", null) {
				public void actionPerformed(ActionEvent evt) {
					/*
					 *  Comienzo Action listeneer del boton Buscar
					 */
					ControladorAdministradorClientes controladorClientes = new ControladorModificarClienteFrame();
					
					if(txtCuitBuscado.getText().equals("")){	// Caso -> NO ingresa datos cliente (el campo esta en blanco)
						JOptionPane.showMessageDialog(null, "Debe de ingresar un nro de cuit");
					} 
					else {	// Caso -> SI ingresa datos (el campo no esta en blanco).
					
						// Cliente NO existe -> Se ofrece crear uno nuevo
						if( ! controladorClientes.existeCliente(txtCuitBuscado.getText())){
							JOptionPane.showMessageDialog(null, "El cliente "+txtCuitBuscado.getText()+" \nno se encuentra cargado " +
									"\nen la base de datos\nIngrese los datos del mismo");
							ChkBoxNuevoCliente.doClick();
							ChkBoxNuevoCliente.setEnabled(false);
							btnBuscarCliente.setEnabled(false);
							txtCuit.setText(txtCuitBuscado.getText());
						} 
						// Cliente SI existe -> Se cargan en pantalla los datos del mismo
						else {	
							Cliente clienteBuscado = controladorClientes.obtenerCliente(txtCuitBuscado.getText());
							txtCuit.setText(clienteBuscado.getCuit());
							txtNombre.setText(clienteBuscado.getNombre());
							txtRazonSocial.setText(clienteBuscado.getRazonSocial());
							txtTelefono.setText(clienteBuscado.getTelefono());
							txtFax.setText(clienteBuscado.getFax());
							txtEmail.setText(clienteBuscado.getEmail());
							txtDireccion.setText(clienteBuscado.getDireccion());
							cmbCategoria.setSelectedItem(clienteBuscado.getCategoria());
							
							ChkBoxNuevoCliente.setEnabled(false);
							btnBuscarCliente.setEnabled(false);
							txtCuitBuscado.setEnabled(false);
							cmbCategoria.setEnabled(false);
						}
					}
				}
			};
		}
		return abstractAction1;
	}

	private JCheckBox getChkBoxNuevoCliente() {
		if(ChkBoxNuevoCliente == null) {
			ChkBoxNuevoCliente = new JCheckBox();
			ChkBoxNuevoCliente.setText("Cliente nuevo");
			ChkBoxNuevoCliente.setAction(getAbstractAction5());
		}
		return ChkBoxNuevoCliente;
	}

	private AbstractAction getAbstractAction2() {
		if(abstractAction2 == null) {
			abstractAction2 = new AbstractAction("Modificar item", null) {
				public void actionPerformed(ActionEvent evt) {
					/*
					 * 		Action Listener del boton Modificar Item
					 */

					JDesktopPane desktop = VentanaPrincipal.obtenerInstancia().getDesktop();
					ModificarItemPresupuestoFrame ventanaModificarItem = new ModificarItemPresupuestoFrame();
					desktop.add(ventanaModificarItem);
					desktop.moveToFront(ventanaModificarItem);
				}
			};
		}
		return abstractAction2;
	}

	private AbstractAction getAbstractAction3() {
		if(abstractAction3 == null) {
			abstractAction3 = new AbstractAction("Borrar item", null) {
				public void actionPerformed(ActionEvent evt) {
					/*
					 * 		Action Listener del boton Borrar Item
					 */

					JDesktopPane desktop = VentanaPrincipal.obtenerInstancia().getDesktop();
					BorrarItemPresupuestoFrame ventanBorrarItem = new BorrarItemPresupuestoFrame();
					desktop.add(ventanBorrarItem);
					desktop.moveToFront(ventanBorrarItem);
				}
			};
		}
		return abstractAction3;
	}

	private AbstractAction getAbstractAction4() {
		if(abstractAction4 == null) {
			abstractAction4 = new AbstractAction("Agregar item", null) {
				public void actionPerformed(ActionEvent evt) {
					/*
					 * 		Action Listener del boton Agregar Item
					 */
					JDesktopPane desktop = VentanaPrincipal.obtenerInstancia().getDesktop();
					AgregarItemPresupuestoFrame ventanaAgregarItem = new AgregarItemPresupuestoFrame();
					desktop.add(ventanaAgregarItem);
					desktop.moveToFront(ventanaAgregarItem);
				}
			};
		}
		return abstractAction4;
	}

	private AbstractAction getAbstractAction5() {
		if(abstractAction5 == null) {
			abstractAction5 = new AbstractAction("Cliente nuevo", null) {
				public void actionPerformed(ActionEvent evt) { 
					/*
					 * 			Action Listener del checkBox de nuevo cliente
					 */
					if (ChkBoxNuevoCliente.isSelected() == true){
						txtCuit.setEditable(true);
						txtDireccion.setEditable(true);
						txtEmail.setEditable(true);
						txtFax.setEditable(true);
						txtNombre.setEditable(true);
						txtRazonSocial.setEditable(true);
						txtTelefono.setEditable(true);
						
						txtCuitBuscado.setEditable(false);
						btnBuscarCliente.setEnabled(false);
					} else {
						txtCuit.setEditable(false);
						txtCuit.setText("");
						txtDireccion.setEditable(false);
						txtDireccion.setText("");
						txtEmail.setEditable(false);
						txtEmail.setText("");
						txtFax.setEditable(false);
						txtFax.setText("");
						txtNombre.setEditable(false);
						txtNombre.setText("");
						txtRazonSocial.setEditable(false);
						txtRazonSocial.setText("");
						txtTelefono.setEditable(false);
						txtTelefono.setText("");
						
						txtCuitBuscado.setEditable(true);
						btnBuscarCliente.setEnabled(true);
					}
				}
			};
		}
		return abstractAction5;
	}

	private AbstractAction getAbstractAction6() {
		if(abstractAction6 == null) {
			abstractAction6 = new AbstractAction("Cancelar", null) {
				public void actionPerformed(ActionEvent evt) {
					dispose();
				}
			};
		}
		return abstractAction6;
	}

	private AbstractAction getAbstractAction7() {
		if(abstractAction7 == null) {
			abstractAction7 = new AbstractAction("Aceptar", null) {
				public void actionPerformed(ActionEvent evt) {
					// En caso de que este activado el nuevo cliente, hay que darle de alta al mismo.
					if (ChkBoxNuevoCliente.isSelected()){
						ControladorAdministradorClientes controladorAgregarCliente = new ControladorAgregarClienteFrame();
						controladorAgregarCliente.cargarNuevoCliente(txtCuit.getText(), txtNombre.getText(), txtRazonSocial.getText(), 
													txtDireccion.getText(), txtTelefono.getText(), txtFax.getText(), txtEmail.getText(),(String) cmbCategoria.getSelectedItem());
						dispose();
					}
				}
			};
		}
		return abstractAction7;
	}

	private JPanel getPanelListadoItems() {
		if(PanelListadoItems == null) {
			PanelListadoItems = new JPanel();
			PanelListadoItems.setBorder(BorderFactory.createTitledBorder("Listado de items"));
			PanelListadoItems.add(getJScrollPane1());
		}
		return PanelListadoItems;
	}

	private JList getListListadoItems() {
		if(ListListadoItems == null) {
//			ListModel ListListadoItemsModel = 
//					new DefaultComboBoxModel(
//							new String[] { "Item One", "Item Two" });
			ListListadoItems = new JList();
//			ListListadoItems.setModel(ListListadoItemsModel);
			ListListadoItems.setPreferredSize(new java.awt.Dimension(554, 83));
		}
		return ListListadoItems;
	}

	private JScrollPane getJScrollPane1() {
		if(jScrollPane1 == null) {
			jScrollPane1 = new JScrollPane();
			jScrollPane1.setPreferredSize(new java.awt.Dimension(554, 83));
			jScrollPane1.setViewportView(getListListadoItems());
		}
		return jScrollPane1;
	}
	
	private JLabel getLblNumeroPresupuesto() {
		if(lblNumeroPresupuesto == null) {
			lblNumeroPresupuesto = new JLabel();
			lblNumeroPresupuesto.setText("Numero de Presupuesto: ");
		}
		return lblNumeroPresupuesto;
	}
	
	private JTextField getTxtNumeroPresupuesto() {
		if(txtNumeroPresupuesto == null) {
			txtNumeroPresupuesto = new JTextField();
		}
		return txtNumeroPresupuesto;
	}

}